from flask import Flask
from core.logger_util import get_logger
from apps.passenger_info_pub.service import info_return,info_insert
from core.tool import check_args
from core.output import OutputHttpResponse
logger = get_logger("访问信息")
app = Flask(__name__)


@app.route('/all_info_list',methods = ['GET'])
def info_list():
    logger.info("接口:all_info_list被访问！!")
    _info = info_return()
    return  OutputHttpResponse.ok(_info)

@app.route('/insert_info',methods = ['POST'])
def insert_data():
    logger.info("接口:insert_info被访问！")
    name = check_args("name",param_type=str)
    is_mask = check_args('is_mask',param_type=int)
    code_states = check_args('code_states',param_type=int)
    temp = check_args('temp',param_type=float)
    info_insert(name,is_mask,code_states,temp)
    return OutputHttpResponse.ok()


if __name__ == '__main__':
    app.run()